package com.wuseguang.springcloud.thread;

import com.wuseguang.springcloud.Classcardservice.ClassCardFieldService;
import com.wuseguang.springcloud.Classcardservice.ClassCardService;
import com.wuseguang.springcloud.JdbcTemplate.HaiweidaCooperativeSchoolJdbc;
import com.wuseguang.springcloud.util.SpringBeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 心跳批量推送
 */
@Component
public class HeartbeatThread implements Runnable {

    private List<String> classList;
    private String type;
    private String state;


    private ClassCardService classCardServiceImpl;
    private ClassCardFieldService classCardFieldServiceImpl;

    public HeartbeatThread() {

    }

    public HeartbeatThread(List<String> classList, String type,String state) {
        this.classList = classList;
        this.type = type;
        this.state = state;
    }

    @Override
    public void run() {
        classCardServiceImpl = SpringBeanUtil.getBean(ClassCardService.class);
        classCardFieldServiceImpl = SpringBeanUtil.getBean(ClassCardFieldService.class);

        //修改班级心跳
        classCardFieldServiceImpl.deviceidAndCards(classList, type, state);
        //推送
        classCardServiceImpl.deviceidAndCards(classList);
    }


    public List<String> getClassList() {
        return classList;
    }

    public void setClassList(List<String> classList) {
        this.classList = classList;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
